package com.wtone.platform.gat.images.gat.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSort;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.wtone.platform.gat.images.gat.model.ResponseStatusListModeObject;
import com.wtone.platform.gat.images.gat.model.SubscribeNotificationListObject;
import com.wtone.platform.gat.images.gat.service.SubscribenotificPublicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: aiLin
 * @Date: 2020/9/29 11:57
 * @desc: 通知相关接口
 */
@Slf4j
@Api(tags = "通知中心", value = "Subscribenotific api")
@ApiSort(3)
@RestController
public class SubscribenotificPublicController {

    @Autowired
    private SubscribenotificPublicService subscribeNotifications;

    @ApiOperation("订阅通知接口 (被订阅者向订阅者发送通知) 发布消息 ")
    @ApiOperationSort(value = 1)
    @RequestMapping(value = "/VIID/SubscribeNotifications", method = RequestMethod.POST, produces="application/json")
    public ResponseStatusListModeObject subscribeNotifications(@RequestBody SubscribeNotificationListObject subscribeNotific){
        return subscribeNotifications.subscribeNotifications(subscribeNotific);
    }

    @ApiOperation("通知查询")
    @ApiOperationSort(value = 2)
    @RequestMapping(value = "/VIID/SubscribeNotifications", method = RequestMethod.GET)
    public SubscribeNotificationListObject selectSubscribeNotifications(
     @RequestParam(name = "NotificationID",required = false) String NotificationID,
     @RequestParam(name = "SubscribeID",required = false) String SubscribeID,
     @RequestParam(name = "Title",required = false) String Title,
     @RequestParam(name = "executeoperation",required = false) String executeoperation){
        return subscribeNotifications.selectSubscribeNotifications(NotificationID,SubscribeID,Title,executeoperation);
    }

    @ApiOperation("通知删除")
    @ApiOperationSort(value = 3)
    @RequestMapping(value = "/VIID/SubscribeNotifications", method = RequestMethod.DELETE)
    public ResponseStatusListModeObject deleteSubscribeNotifications(@RequestParam(name = "IDList",required = true) String IDList){
        return subscribeNotifications.deleteSubscribeNotifications(IDList);
    }

}
